#encoding:utf-8
require "mysql2"
require "erb"
#require "yaml"
require File.dirname(__FILE__)+"/bean_info"

#yaml
#YAML_URL = File.dirname(__FILE__)+"/yaml/template.yml"

DB =  File.dirname(__FILE__)+"/erb/db/db.erb"
class DbMysql

  def initialize(bean)
    @bean = bean
  end

  def create
    begin
      puts "create table..."
      client = Mysql2::Client.new(:host => '10.10.59.24', :database => 'hotel', :username => "root", :password => "123456", :flags => Mysql2::Client::MULTI_STATEMENTS)
      beanInfo =@bean
      template=IO.read(DB)
      message=ERB.new(template)
      client.query(message.result(binding))
      puts "create table success..."
    rescue Mysql2::Error => e
      puts e.errno
      puts e.error
    ensure
      client.close if client
    end
  end
end

str='publicDate'
puts str.gsub(/\b\w/) { $&.upcase }